package com.flashcash.kotlin.utils

import android.app.Activity
import android.content.Context
import android.os.Bundle
import com.google.firebase.analytics.FirebaseAnalytics

object FirebaseAnalyticsUtils {

    private lateinit var firebaseAnalytics: FirebaseAnalytics

    fun initialize(context: Context) {
        firebaseAnalytics = FirebaseAnalytics.getInstance(context)
    }

    fun logEvent(event: String, bundle: Bundle?) {
        with(firebaseAnalytics) {
            logEvent(event, bundle)
        }
    }

    fun setCurrentScreen(activity: Activity, name: String) {
        with(firebaseAnalytics) {
            this.setCurrentScreen(activity, name, null)
        }
    }

    fun setUserId(userId: String) {
        with(firebaseAnalytics) {
            setUserId(userId)
        }
    }

    fun setUserProperty(key: String, value: String) {
        with(firebaseAnalytics) {
            setUserProperty(key, value)
        }
    }
}

object FirebaseAnalyticsConstants {
    object Param {
    }

    object Event {
        const val ACT_OPEN = "act_open" // (打开应用)
        const val BTN_LOGIN = "btn_login" // (点击登录按钮)
        const val BTN_LOGOUT = "btn_logout" // (点击登出按钮)

        const val BTN_APPLY = "btn_apply" // (点击首页fragment的apply now按钮)
        const val BTN_APPLY_SUBMIT = "btn_apply_submit" // (点击certification这个fragment页面的submit按钮)

        const val EXPOSURE_IDENTITY_INFO = "exposure_identity_info" // 身份证信息页曝光加载事件
        const val BTN_IDENTITY_INFO_SUBMIT = "btn_identity_info_submit" // (点击身份证信息页的submit按钮)
        const val BTN_IDENTITY_INFO_EDIT = "btn_identity_info_submit" //(编辑身份证信息页面)
        const val EXPOSURE_PERSONAL_INFO = "exposure_personal_info" // 个人信息页曝光事件
        const val BTN_PERSONAL_INFO_SUBMIT = "btn_personal_info_submit" // (点击个人信息页的submit按钮)
        const val BTN_PERSONAL_INFO_SUBMIT_SUCCESS = "btn_personal_info_submit_success" // (点击个人信息页的提交信息成功)
        const val EXPOSURE_CONTACT_INFO = "exposure_contact_info" // (联系人信息页曝光)
        const val BTN_CONTACT_INFO_SUBMIT = "btn_contact_info_submit" // (点击联系人信息页的submit按钮)
        const val BTN_CONTACT_INFO_SUBMIT_SUCCESS = "btn_contact_info_submit_success" // (点击联系人信息页的submit成功)
        const val EXPOSURE_EMPLOY_INFO = "exposure_employ_info" //  (职业信息页曝光)
        const val BTN_EMPLOY_INFO_SUBMIT = "btn_employ_info_submit" //  (点击职业信息页的submit按钮)
        const val BTN_EMPLOY_INFO_SUBMIT_SUCCESS = "btn_employ_info_submit_success" //  (点击职业信息页的submit成功)
        const val BTN_EMPLOY_INFO_PHOTO = "btn_employ_info_photo" //(点击职业信息页的照片图片)

        const val BTN_BANK_INFO_SUBMIT = "btn_bank_info_submit" // (点击填写银行页面的submit按钮)
        const val BTN_WITHDRAWAL_OPTION = "btn_withdrawal_option" // (点击填写银行页面切换取款渠道方式)
        const val SELECT_WITHDRAWAL_GCASH = "select_withdrawal_gcash" // 选择取款方式
        const val SELECT_WITHDRAWAL_COINS = "select_withdrawal_coins" // 选择取款方式
        const val SELECT_WITHDRAWAL_M_L_HULLIER = "select_withdrawal_m_l_hullier" // 选择取款方式

        const val EXPOSURE_SUBMITTED_LOAN = "exposure_submitted_loan" // 贷款提交成功页面曝光

        const val BTN_CLICK_DISABLED_PRODUCT = "btn_click_disable_product" // (点击还不能申请的产品)
        const val BTN_CLICK_ENABLED_PRODUCT = "btn_click_enabled_product" // (点击可申请的产品)

        const val BTN_CERTIFICATION_STEP1 = "btn_certification_step1" //(点击Certification Fragment第一步的按钮)
        const val BTN_CERTIFICATION_STEP2 = "btn_certification_step2" //(点击Certification Fragment第二步的按钮)
        const val BTN_CERTIFICATION_STEP3 = "btn_certification_step3" //(点击Certification Fragment第三步的按钮)
        const val BTN_CERTIFICATION_STEP4 = "btn_certification_step4" //(点击Certification Fragment第四步的按钮)

        const val CHECKBOX_VERIFICATION_FACEBOOK = "checkbox_verification_facebook" //(第三方登录点击FaceBook checkbox)
        const val CHECKBOX_VERIFICATION_LAZADA = "checkbox_verification_lazada" //(第三方登录点击FaceBook checkbox)
        const val BTN_VERIFICATION_SUBMIT = "btn_verification_submit" //(第三方登录点击submit的按钮)

        const val ACT_MORE_LOAN_AD = "act_more_loan_ad"//用户点击拒绝后弹窗里面的更多贷款广告

        const val SHOW_CREDIT_TIPS = "show_credit_tips"//当新客首次完成资料填写后进入列表页toast提示“Dear user，thank you for your use，show you the following products”出现的事件

        const val EXPOSURE_NEW_HOME = "exposure_new_home"//新首页曝光打开事件
        const val BTN_NEW_HOME_GET_CASH_NOW = "btn_new_home_get_cash_now"//首页的“Get Cash Now”点击事件
        const val BTN_NEW_HOME_LOGIN = "btn_new_home_login"//首页的“I am ready…”链接的点击事件

        //证件信息页
        const val IDENTITY_ID_TYPE = "identity_id_type" // 身份证类型
        const val IDENTITY_ID_PHOTO = "identity_id_photo" // 身份证照片
        const val IDENTITY_ID_EXAMPLE = "identity_id_example" // 身份证样例
        const val IDENTITY_ID_NUMBER = "identity_id_number" // 身份证号码
        const val IDENTITY_ID_FIRSTNAME = "identity_id_firstname"
        const val IDENTITY_ID_MIDDLENAME = "identity_id_middlename"
        const val IDENTITY_ID_LASTNAME = "identity_id_lastname"
        const val IDENTITY_ID_GENDAR = "identity_id_gendar"
        const val IDENTITY_ID_BIRTHDAY = "identity_id_birthday"

        //证件信息页
        const val PERSONAL_EDUCATION = "personal_education"
        const val PERSONAL_MARRIAGE = "personal_marriage"
        const val PERSONAL_CHLIDREN = "personal_chlidren"
        const val PERSONAL_RESIDENCE_ADDRESS = "personal_residence_address"
        const val PERSONAL_FULL_ADDRESS = "personal_full_address"
        const val PERSONAL_RESIDENCE_ADDRESS_DURATION = "personal_residence_address_duration"
        const val PERSONAL_FACEBOOK_NAME = "personal_facebook_name"

        //联系人信息页
        const val CONTACT_PARENT = "contact_parent"
        const val CONTACT_FREND = "contact_frend"

        //证件信息页
        const val JOB_EXAMPLE = "job_example"
        const val JOB_EMPLOYEE_CARD = "job_employee_card"
        const val JOB_OCCUPATION = "job_occupation"
        const val JOB_COMPANY_NAME = "job_company_name"
        const val JOB_YEAR_IN_CURRENT_COMPANY = "job_year_in_current_company"
        const val JOB_MONTH_SALARY = "job_month_salary"
        const val JOB_OFFICE_PHONE_NUMBER = "job_office_phone_number"
        const val JOB_CONVENIENT_TIME = "job_convenient_time"
        const val JOB_COMPANY_ADDRESS = "job_company_address"
        const val JOB_FULL_ADDRESS = "job_full_address"

        //个人菜单
        const val ME_LOG_OUT = "me_log_out"
        const val ME_CERTIFICATION = "me_certification"
        const val ME_MYLEVEL = "me_mylevel"
        const val ME_HELPCENTER = "me_helpcenter"
        const val ME_ABOUTUS = "me_aboutus"

        //成功提交页
        const val REVIEW_MY_LOAN = "review_my_loan"

        //我的贷款页
        const val MYLOAN_CANCEL = "myloan_cancel"


    }
}